import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const state = {
    urlId:"",
    urlPage:"",
    urlName:"",
    pageSetting: [
        {
            title: "页面设置",
            name: "nameless",
            styles: {
                modulePage: "1",
                colorIcon: "#F5F5F5",
                colorBg: "#fff",
                moduleTitle: "1",
                title: "列表标题",
                navTitle: "导航标题",
                img: "",
                colorWord: "#333"
            },
        }
    ],
    susBtn: [
        {
            title: "悬浮设置",
            name: "susBtn",
            status: 0,
            styles: {
                status: 0,
                type: "left",
                shifting: 600,
                imgUrl: [
                    {
                        img: "",
                        url: "",
                    },
                ],
            },
        }
    ],
    attention: [
        {
            title: "关注条",
            name: "attention",
            styles: {
                status: 0,
                img: "",
                text: "点击关注我们哦~"
            },
        }
    ],
    remind: [
        {
            title: "下单提醒",
            name: "remind",
            styles: {
                status: 0,
                colorWord: "#fff",
                colorBg: "#000",
                percent: 80,
                shifting: 120,
                type: "2",
                numberList: [
                    {
                        img: "",
                        text: "",
                        time: "",
                    },
                    {
                        img: "",
                        text: "",
                        time: "",
                    },

                ]
            },
        }
    ],
    open: [
        {
            title: "启动页",
            name: "open",
            styles: {
                status: "1",
                type: "1",
                times: "1",
                colorBg: "#000",
                percent: 30,
                imgUrl: [
                    { img: "", url: "" }
                ]
            },
        }
    ],
    menu: [
        {
            title: "导航",
            name: "menu",
            styles: {
                colorSelect: "#2D8CF0",
                colorUnselect:"#999",
                colorLine: "#eee",
                colorBg: "#fff",
                imgUrl: [
                    {
                        text: "按钮",
                        front: [
                            {
                                img: ""
                            }
                        ],
                        back: [
                            {
                                img: ""
                            }
                        ],
                        url: ""
                    },
                    {
                        text: "按钮",
                        front: [
                            {
                                img: ""
                            }
                        ],
                        back: [
                            {
                                img: ""
                            }
                        ],
                        url: ""
                    },
                    {
                        text: "按钮",
                        front: [
                            {
                                img: ""
                            }
                        ],
                        back: [
                            {
                                img: ""
                            }
                        ],
                        url: ""
                    },
                    {
                        text: "按钮",
                        front: [
                            {
                                img: ""
                            }
                        ],
                        back: [
                            {
                                img: ""
                            }
                        ],
                        url: ""
                    },
                    {
                        text: "按钮",
                        front: [
                            {
                                img: ""
                            }
                        ],
                        back: [
                            {
                                img: ""
                            }
                        ],
                        url: ""
                    },

                ]
            },
        }
    ],
    list: [],
    currentId: "0",
    currentName: "",
}

const mutations = {
    //大对象
    getList(state, list) {
        state.list = JSON.parse(list)
    },
    //页面设置
    getPageSetting(state, list) {
        state.pageSetting = JSON.parse(list)
    },
    //悬浮按钮
    getSusBtn(state, list) {
        state.susBtn = JSON.parse(list)
    },
    //关注条
    getAttention(state, list) {
        state.attention = JSON.parse(list)
    },
    //下单提醒
    getRemind(state, list) {
        state.remind = JSON.parse(list)
    },
    //启动页
    getOpen(state, list) {
        state.open = JSON.parse(list)
    },
    //导航
    getMenu(state, list) {
        state.menu = JSON.parse(list)
    },
    // ---------------------------
    //当前选中列
    getCurrenChoose(state, currentId) {
        state.currentId = currentId
    },
    //当前选中列名字
    getCurrenChooseName(state, currentName) {
        state.currentName = currentName
    },
    //获取urlid
    getUrlId(state, urlId) {
        state.urlId = urlId
    },
    //获取urlPage
    getUrlPage(state, urlPage) {
        state.urlPage = urlPage
    },
    //获取urlName
    getUrlName(state, urlName) {
        state.urlName = urlName
    },

}

const actions = {

}

const getters = {

}
export function createStore() {
    return new Vuex.Store({
        state,
        actions,
        mutations,
        getters,
        modules: []
    })
}
